let numbers: number[] = [1,1]; // 空数组
console.log(maxArea(numbers));


function maxArea(height: number[]): number {
    let max:number=0;
    let l:number=0,r:number=height.length-1;

    
    while(l<=r){
        let nowArea:number=(r-l)*(height[l]>height[r]?height[r]:height[l])
        max= max>nowArea ?max:nowArea
        if(height[l]>height[r]){
            r--;
            continue;
        }else if(height[l]<height[r]){
            l++;
            continue
        }else{
            if(l+1===r)
                break;
            if(height[r-1]>height[l+1])
                r--;
            else l++;
        }
    }
    return max;    
};